<?php 

//1头部
header("Content-type: image/png");




//2创建画布
$src = imageCreateTrueColor(500,250); 
$color = imageColorAllocate($src,0,0,0);
imageFill($src,0,0,$color);
$color = imageColorAllocate($src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
// imagerectangle ( $src, 0 , 0 , 200 , 100 , $color);


// imagefilledellipse ($src,);
 // imagefilledellipse ( $src, 250 , 125 , 250 , 250 , $color );
 imagefilledrectangle ( $src , 50 , 70 , 450 , 200,  $color );
for ($i=0; $i <100 ; $i++) { 
	$color = imageColorAllocate($src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
	imageline ( $src , mt_rand(70,450) ,mt_rand(70,80),mt_rand(50,450), mt_rand(190,200),  $color );
}
for ($i=0; $i <2000 ; $i++) { 
	$color = imageColorAllocate($src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
imagesetpixel ( $src , mt_rand(50,450), mt_rand(70,200), $color );
}



for ($i=0; $i <4 ; $i++) { 
	$arr='qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789';
	$arrr=$arr[mt_rand(0,61)];

	// $i==0?$hhh=$i*(400/4)+(400/4-70)/2+50:$hhh=$i*(400/4)+(400/4-70)/2;
	// 
	// if($i==0){
	// 	$hhh=$i*(400/4)+(400/4-70)/2+50;
	// }else{
	// 	$hhh=$i*(400/4)+(400/4-70)/2+30;
	// }
	$hhh=$i*(400/4)+(400/4-70)/2+50;


	$color = imageColorAllocate($src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));

	imagettftext ( $src, 70,mt_rand(-30,30), $hhh , 160 ,$color , "./Fritz Bold.ttf", $arrr);
}








//3输出
imagepng($src);  


//4释放资源
imageDestroy($src) ;




 ?>